#include<bits/stdc++.h>

#define rp(i,a,b) for(int i=a;i<b;++i)
#define rrp(i,b,a) for(int i=b;i>=a;--i)

using namespace std;

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

int n;

struct node
{
	int c = 0;
	std::vector<int> connectNode;
};

std::vector<node> tree;
std::vector<int> myvisit;
std::vector<pair<int,int>> v;
unordered_map< pair<int,int>, vector<int>, hash_pair>mp;

void Myrevese(pair<int,int> pr){
	pair<int,int>pairtmp = make_pair(pr.second,pr.first);
	int a[n+1];
	fill(a,a+n+1,0);
	rp(i , 0 , mp[pr].size()){
		a[mp[pr][i]] = 1;
	}
	rp(i , 1 , n+1){
		if(a[i] == 0){
			mp[pairtmp].emplace_back(i);
		}
	}
}


void cal(pair<int,int> pr){
	mp[pr].emplace_back(pr.second);
	int size = tree[pr.second].connectNode.size();
	rp(i , 0 , size){
		if(tree[pr.second].connectNode[i]!=pr.first){
			pair<int,int>pairtmp = make_pair(pr.second,tree[pr.second].connectNode[i]);
			if(mp[pairtmp].size() == 0)
				cal(pairtmp);
			mp[pr].insert(mp[pr].end(),mp[pairtmp].begin(),mp[pairtmp].end());
		}
	}
	Myrevese(pr);
}

void Myadd(pair<int,int>pr,int c){
	int size = mp[pr].size();
	rp(i , 0 , size){
		int index = mp[pr][i];
		tree[index].c += c;
	}
}


int main(){
	scanf("%d", &n);
	v.resize(n+1);tree.resize(n+1);myvisit.resize(n+1);
	rp(i , 1 , n){
		scanf("%d%d", &v[i].first,&v[i].second);
		tree[v[i].first].connectNode.emplace_back(v[i].second);
		tree[v[i].second].connectNode.emplace_back(v[i].first);
	}

	int q;scanf("%d", &q);
	rp(i , 0 , q){
		int t,e,x;scanf("%d%d%d", &t,&e,&x);
		if(mp[v[e]].size() == 0)cal(v[e]);
		int a = v[e].first,b=v[e].second;
		// printf("a=%d b=%d\n",a,b );
		if(t == 2){
			Myadd(make_pair(a,b),x);
		}else{
			Myadd(make_pair(b,a),x);
		}
	}
	rp(i , 1 , n+1){
		printf("%d\n",tree[i].c);
	}
	return 0;
}